<?php
/**
 * Created by PhpStorm.
 * User: 技术员专用
 * Date: 2019/2/21
 * Time: 9:45
 */

namespace app\index\controller;


use think\Controller;

class Aiyun extends Controller
{
    public function index()
    {
        $post = input('post.');
        echo '{"rs":1,"tip":"bot回复","end":0}';
        $post['nickname'] = unicodeDecode($post['nickname']);
        $post['displayname'] = unicodeDecode($post['displayname']);
        $post['content'] = unicodeDecode($post['content']);
        $post['robotnickname'] = unicodeDecode($post['robotnickname']);
        cache('aaa', $post);
    }

    public function findex()
    {
        $post = input('post.');
        $post['robotnickname'] = unicodeDecode($post['robotnickname']);
        $post['nickname'] = unicodeDecode($post['nickname']);
        $post['content'] = unicodeDecode($post['content']);
        cache('bbb', $post);
        $arr=[
            "rs"=>1,
            "tip"=>urlencode("么么哒(づ 3 )づ[结束][img]http://www.dijiu.com/upload/2009/2/24/2009022479639361.gif[/img][结束][img]http://www.dijiu.com/upload/2009/2/24/2009022479639361.gif[/img]"),
            "end"=>0,
        ];
        echo urldecode(json_encode($arr));
        echo '{"rs":1,"tip":"么么哒(づ 3 )づ[结束][img]http://www.dijiu.com/upload/2009/2/24/2009022479639361.gif[/img][结束][img]http://www.dijiu.com/upload/2009/2/24/2009022479639361.gif[/img]","end":0}';
    }

    public function qindex(){
        $post = input('post.');
        cache('ccc', $post);
        cache('ccctime', time());
        $time=time()+130;
        $arr=[
            'rs'=>1,
            'content'=>urlencode('定时消息的内容'),
            'sendtime'=>"$time",
            'end'=>1,
        ];
        echo urldecode(json_encode($arr));
    }
    public function gindex(){
        $post = input('post.');
        cache('ddd', $post);
        cache('dddtime', time());
        //{"rs":1,"wxid":"发送对象支持任意好友，任意群（友：wxid_xxxxxx，群：xxxx@chatroom）","content":"定时消息的内容","sendtime":"指定发送时间（格式：时间戳 , 秒级）","end":1}
        $time=time()+30;
        $arr=[
            'rs'=>1,
            'wxid'=>'wxid_ftlyl9iu353512',
            'content'=>urlencode('定时消息的内容1'),
            'sendtime'=>"$time",
            'end'=>1,
        ];
        echo urldecode(json_encode($arr));
    }

    public function indexdata()
    {
//        echo "<pre/>";
//        $aaa = cache('aaa');
//        print_r($aaa);
//        $bbb = cache('bbb');
//        print_r($bbb);
//        $ccc= cache('ccc');
//        print_r($ccc);
//        $ddd= cache('ddd');
//        print_r($ddd);
//        $ccctime= cache('ccctime');
//        print_r($ccctime);
//        $dddtime = cache('dddtime');
//        echo "<br>";
//        print_r($dddtime);
//        $asdf= cache('asdf');
//        print_r($asdf);
//        $fdsa= cache('fdsa');
//        print_r($fdsa);
        print_r(phpinfo());
    }
}